<?php

class Application_Acl
{
    static private $_instance = null;

    static public function getInstance()
    {
        if (is_null(self::$_instance)) {
            self::$_instance = new self();
        }
        return self::$_instance;
    }

    private function __clone() {}

    /**
     * @var Zend_Acl
     */
    private $_acl = null;

    /**
     * @var Application_Auth_User
     */
    private $_userIdentity = null;

    private function __construct()
    {
        $this->_acl = Zend_Registry::get('acl');
        $this->_userIdentity = Zend_Auth::getInstance()->getIdentity();
    }

    /**
     * @param mixed $resource
     * @param mixed $privilege
     */
    public function isAllowed($resource, $privilege)
    {
        return $this->_acl->isAllowed($this->_userIdentity, $resource, $privilege);
    }
}